package lab01;

import java.util.Scanner;

public class Test12 {

    public static void main(String[] args) {

        System.out.println("请输入一个数（1-9999）：");

        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int single = num % 10;
        int decade = num / 10 % 10;
        int hundred = num / 100 % 10;
        int thousand = num / 1000;

        if (num / 1000 >= 1) {
            System.out.println("这个数是四位");
            if (single == thousand && decade == hundred) {
                System.out.println("这个数是回文数：" + num);
            } else {
                System.out.println("不是回文数：" + num);
            }
        } else if (num / 100 >= 1) {
            System.out.println("这个数是三位");
            if (single == hundred) {
                System.out.println("这个数是回文数：" + num);
            } else {
                System.out.println("不是回文数：" + num);
            }
        } else if (num / 10 >= 1) {
            System.out.println("这个数是两位");
            if (single == decade) {
                System.out.println("这个数是回文数：" + num);
            } else {
                System.out.println("不是回文数：" + num);
            }
        } else {
            System.out.println("这个数是一位");
            System.out.println("不是回文数：" + num);
        }
    }
}
